<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="js/jquery-1.11.0.min.js"></script>
<body>
<div>
    <p>一类账户开户</p>

    <form>
        <input type="hidden" name="id" id="id">
        姓名：<input type="text" id="name" name="name" placeholder="请输入姓名"> <br>
        手机号：<input type="text" id="phone" name="phone" placeholder="请输入手机号"> <br>
        选择银行：<select id="bank">
        <option>中国银行</option>
        <option>农业银行</option>
        <option>工商银行</option>
        <option>建设银行</option>
    </select><br>
        支付密码：<input type="password" id="password" name="password" placeholder="请输入支付密码"> <br>
        请确认支付密码：<input type="password" id="password1" name="password1" placeholder="请确认您的密码"> <br>
        <input type="button" value="开户" id="openAccount">

    </form>


</div>
<table width="100%" id="shouye">
    <tr>
        <td align="center"><a href="/airong/index.html">首页</a></td>
        <!--    <td align="center"><a href="#"><input type="button" id="lc" value="理财"></a></td>-->
        <td align="center"><a href="" id="lc">理财</a></td>
        <td align="center"><a href="/airong/personalCenter.html">我的</a></td>

    </tr>
</table>

</body>
<script>
    let urll = "/airong/cc?action=getSessionID";
    let paramsl = {}
    $.get(urll,paramsl,function (sessionID){
        document.getElementById('lc').href= "products.html?uid="+sessionID;
    },"text")

    $("#openAccount").click(function (){
        let url = "/airong/card?action=openAccount1";
        let id =  $("#id").val();
        let name = $("#name").val();
        let phone = $("#phone").val();
        let bankType = $("#bank").val()
        let password = $("#password").val();
        let password1 = $("#password1").val();

        let params = {id,name,phone,bankType,password,password1}

        $.post(url,params,function (data){
            if (data === "\"true\""){
                alert("开户成功")
                location.href = "account.html"
            }else if (data === "\"falsePwdLength\""){
                alert("开户失败")
                $("#error").html("密码必须为6位数字")
            }else if (data === "\"falsePwd\""){
                alert("开户失败")
                $("#error").html("两次输入的密码必须相同")
            }else if (data === "\"falsePhone\""){
                alert("开户失败")
                $("#error").html("手机号必须为11位")
            }else {
                alert("开户失败")
                $("#error").html("请重新输入")
            }
        },"text")
    })
</script>
<style>
    div {

        width: 100%;
        text-align: center;
    }
    input{
        padding: 10px;
        margin: 10px;
        text-align: left;
    }
    #shouye{
        position: absolute;
        top: 600px;
        padding: 5px;
        margin: 4px;
        background-color: bisque;
        font-size: 20px;
        text-align: center;
        z-index: 1;
    }
</style>
</html>